import request from '@/service/index.js'
export const addHotSaleRankingItem = (categoryId, status) => {
  // 第二个参数：请求体（空，因为参数在 URL 里）
  // 第三个参数：配置项，params 对应 URL 拼接的参数
  return request.post(
    `/ranking/add`,
    {},
    {
      params: {
        categoryId,
        status,
      },
    }
  )
}

export const queryHotSaleRankingList = (keyword, page, pageSize) => {
  return request.get('/ranking/list', {
    params: {
      keyword,
      page,
      pageSize,
    },
  })
}

export const deleteHotSaleRankingItem = (categoryId) => {
  return request.delete(`/ranking/delete`, {
    params: {
      categoryId,
    },
  })
}

export const updateHotSaleRankingItem = (categoryId, status) => {
  return request.put(
    `/ranking/update`,
    {},
    {
      params: {
        categoryId,
        status,
      },
    }
  )
}
